<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('留言板列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>标题：</label>
                                <input type="text" name="mbTopic"/>
                            </li>
                            <li>
                                <label>留言类型：</label>
                                <select name="mbType" th:with="type=${@dict.getType('mbs_message_board_type')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>处理状态：</label>
                                <select name="disposeStatus" th:with="type=${@dict.getType('mbs_dispose_status')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var detailFlag = [[${@permission.hasPermi('mbs:mbinfo:detail')}]];
        var editFlag = [[${@permission.hasPermi('mbs:mbinfo:edit')}]];
        var removeFlag = [[${@permission.hasPermi('mbs:mbinfo:remove')}]];
        var mbTypeDatas = [[${@dict.getType('mbs_message_board_type')}]];
        var dStatusDatas = [[${@dict.getType('mbs_dispose_status')}]];
        var prefix = ctx + "mbs/mbinfo";

        $(function() {
            var options = {
                url: prefix + "/user/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                detailUrl: prefix + "/detail/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "留言板",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'mbId',
                    title: '主键',
                    visible: false
                },
                {
                    field: 'mbTopic',
                    title: '标题'
                },
                {
                    field: 'mbContent',
                    title: '内容',
                    align: 'center',
                    formatter: function(value, row, index) {
                        return $.table.tooltip(value, 10, "open");
                    }
                },
                {
                    field: 'mbType',
                    title: '留言类型',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(mbTypeDatas, value);
                    }
                },
                {
                    field: 'disposeStatus',
                    title: '处理状态',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(dStatusDatas, value);
                    }
                },
                    {
                        field: 'disposeContent',
                        title: '回复',
                        align: 'center',
                        formatter: function(value, row, index) {
                            return $.table.tooltip(value, 10, "open");
                        }
                    },
                {
                    field: 'createTime',
                    title: '提交时间'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-warning btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.mbId + '\')"><i class="fa fa-search"></i>详细</a>');
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="edit(\'' + row.mbId + '\' , \'' + row.disposeStatus + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="remove(\'' + row.mbId + '\' , \'' + row.disposeStatus + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
        
        function edit(mbId, status) {
            if(status != 0){
                $.modal.msgError("已处理，无法修改！");
                return;
            }
            $.operate.editTab(mbId);
        }

        function remove(mbId, status) {
            if(status != 0){
                $.modal.msgError("已处理，无法删除！");
                return;
            }
            $.operate.remove(mbId);
        }

    </script>
</body>
</html>